﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace TesterLibrary
{
    [Serializable]
    public class Answer
    {
        protected string text;      // text of the answer.
        protected bool correct;     // if the answer is correct or not.

        #region Properties
        public bool Correct
        {
            get { return correct; }
            set { correct = value; }
        }

        public string Text
        {
            get { return text; }
            set { text = value; }
        }
        #endregion

        /// <summary>
        /// Generates a blank answer
        /// </summary>
        public Answer()
        {
            text = string.Empty;
            correct = false;
        }

        /// <summary>
        /// Outputs the answer text in a well formatted manor.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return base.ToString();
        }

        public void ToXml(System.Xml.XmlWriter xmlWriter)
        {
            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
            namespaces.Add("ans", @"Schemas\Answer.xsd");

            XmlSerializer serializer = new XmlSerializer(this.GetType());
            serializer.Serialize(xmlWriter, this, namespaces);
        }
    }
}
